<?php

namespace Admin\Service;
use \Common\Service\BaseService;

/** 
 * 赛事
 * @author Legend. <xcx_legender@qq.com>
 * @param 
 * @return 
 */

Class MatchService extends BaseService
{
	/**
	*id, title, logo:图标, status, detail, create_time, update_time, // more...
	*game_id ,cover:封面, match_time:赛事时间
	*schedule:赛事的赛程 //add by susy.liang 2015/7/29
	*sort:赛事的排序 升序 //add by susy.liang 2015/7/29
	*/

	// 状态
	CONST STATUS_PEDDING = 0;	// 审核 pedding
	CONST STATUS_PASS 	 = 1;	// 展示 pass
	CONST STATUS_DEL  	 = -1;  // 删除 delete

	//ERROR 错误
	CONST ERROR_TITLE 	 = '标题不能为空!';
	CONST ERROR_LOGO 	 = 'LOGO不能为空!';

	protected $_validate = array(
		array('title', 'require', self::ERROR_TITLE, self::MUST_VALIDATE , 'regex', self::MODEL_BOTH),
		array('teamlogo', 'require', '请上传默认队伍LOGO', self::MUST_VALIDATE , 'regex', self::MODEL_BOTH),
		array('game_id', 'require', '请选择游戏', self::MUST_VALIDATE , 'regex', self::MODEL_BOTH),
		array('cover', 'require', '请上传赛事的封面图', self::MUST_VALIDATE , 'regex', self::MODEL_BOTH),
		array('subtitle', 'require', '请设置赛事的短标题', self::MUST_VALIDATE , 'regex', self::MODEL_BOTH),
		// array('logo', 'require', self::ERROR_TITLE, self::MUST_VALIDATE , 'regex', self::MODEL_BOTH),
	);

	protected $_auto = array(
        array('title', 'htmlspecialchars', self::MODEL_BOTH, 'function'),
        array('detail', 'htmlspecialchars', self::MODEL_BOTH, 'function'),
        array('create_time', NOW_TIME, self::MODEL_INSERT),
        array('update_time', NOW_TIME, self::MODEL_BOTH),
        array('match_time', 'strtotime', self::MODEL_BOTH, 'function'),
        array('match_hour', 'htmlspecialchars', self::MODEL_BOTH, 'function'),
        array('sort', intval, self::MODEL_BOTH, 'function'),
        array('status', intval, self::MODEL_BOTH, 'function'),
        array('match_state', intval, self::MODEL_BOTH, 'function'),
        array('id', intval, self::MODEL_UPDATE, 'function'),
        array('game_id', intval, self::MODEL_BOTH, 'function'),
    );


}